import java.io.Serializable;
import java.time.LocalDate;
import java.util.Date;
import java.time.*;

/**
 * @author: hyf
 * @date: 2024/4/7 14:18
 * @description: TODD
 * @modifiedBy:
 * @version: 1.0
 */
public class TravelPackage implements Serializable {
    private int Id;
    private int customerId;
    private LocalDate startDate;
    private int duration;
    private Accommodation accommodation;
    private boolean liftPasses;//Lift passes
    private int lessons;
    private Customer customer;
    static int nextID = 10;

    public TravelPackage(){
        Id = nextID++;
    }

    public TravelPackage(int customerId, LocalDate startDate, int duration, Customer customer, Accommodation accommodation) {
        this.customerId = customerId;
        this.startDate = startDate;
        this.duration = duration;
        this.accommodation = accommodation;
        this.customer = customer;
        this.liftPasses = false;
        this.lessons = 0;
        Id=nextID++;
    }
    public int getId() {
        return Id;
    }

    public void setId(int id) {
        Id = id;
    }

    public int getCustomerId() {
        return customerId;
    }

    public Customer getCustomer() {
        return customer;
    }

    public void setCustomerId(int customerId) {
        this.customerId = customerId;
    }

    public LocalDate getDate () {
        return startDate;
    }

    public void setDate (String dateStr) {
        startDate = LocalDate.parse(dateStr);
    }

    public int getDuration() {
        return duration;
    }

    public void setDuration(int duration) {
        this.duration = duration;
    }

    public Accommodation getAccommodation() {
        return accommodation;
    }

    public void setAccommodation(Accommodation accommodation) {
        this.accommodation = accommodation;
    }

    public boolean getLiftPasses() {
        return liftPasses;
    }

    public void setLiftPasses() {
        this.liftPasses = true;
    }

    public int getLessons() {
        return lessons;
    }

    public void setLessons(int lessons) {
        this.lessons = lessons;
    }

    public void addLessons(int count) {
        this.lessons += count;
    }
    // lift花费lesson花费
//    public double calculateTotalCost() {
//        double accommodationCost = accommodation.getPrice() * duration;
//        double liftPassCost = calculateLiftPassCost();
//        double lessonCost = lessons * getLessonFee();
//        return accommodationCost + liftPassCost + lessonCost;
//    }



    private String getCustomerLevel() {
        // Assume a method to retrieve customer level
        return "beginner"; // Defaulting to beginner level for now
    }

    private double getLessonFee() {
        switch (getCustomerLevel()) {
            case "beginner":
                return 25.0;
            case "intermediate":
                return 20.0;
            case "expert":
                return 15.0;
            default:
                return 0.0;
        }
    }
    @Override
    public String toString() {
        return
                "package Id=" + Id +
                ", customerId=" + customerId +
                ", startDate=" + startDate +
                ", duration=" + duration +
                        "\n"+
                "" + accommodation +
                ", liftPasses=" + liftPasses +
                ", lessons=" + lessons +
                '}';
    }
}

